/*
 * Copyright (c) 2006, 2022, webrx.cn All rights reserved.
 *
 */
package cn.webrx;

import java.util.Arrays;
import java.util.Random;

/**
 * <p>Project: app2022 - Arr4
 * <p>Powered by webrx On 2022-01-08 15:50:24
 *
* @author webrx [webrx@126.com]
 * @version 1.0
 * @since 17
 */
public class Arr4 {
    public static void main(String[] args) {
        var ns = new int[10];
        var rand = new Random();
        for (int i = 0; i < ns.length; i++) {
            ns[i] = rand.nextInt(25) + 1;
        }

        for (int n : ns) {
            System.out.println(n);
        }

        //判断数组元素有没有20
        boolean f = false;
        for (int n : ns) {
            if (20 == n) {
                f = true;
                break;
            }
        }
        if (f) {
            System.out.printf("%d 在 数组中%s存在", 20, Arrays.toString(ns));
        } else {
            System.out.printf("%d 在 数组中%s不存在", 20, Arrays.toString(ns));
        }
    }
}
